cmake_minimum_required(VERSION 3.28)
project(ODUpdaterSDK)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_library(ODUpdaterSDK STATIC
        include/config/handler/IUpdateHandler.h
        config/handler/event/UpdateStartEvent.cpp
        include/config/handler/event/UpdateStartEvent.h
        obj/Res.cpp
        include/obj/Res.h
        config/handler/event/PreUpdateEvent.cpp
        include/config/handler/event/PreUpdateEvent.h
        config/handler/event/UpdateEvent.cpp
        include/config/handler/event/UpdateEvent.h
        config/handler/event/UpdatingEvent.cpp
        include/config/handler/event/UpdatingEvent.h
        include/config/transmit/IStreamTransmit.h
        config/handler/event/PostUpdateEvent.cpp
        include/config/handler/event/PostUpdateEvent.h
        config/handler/event/UpdateErrorEvent.cpp
        include/config/handler/event/UpdateErrorEvent.h
        config/handler/event/UpdateCompleteEvent.cpp
        include/config/handler/event/UpdateCompleteEvent.h
        obj/UpdateError.cpp
        include/obj/UpdateError.h
        include/config/proceessing/search/IResSearchProcessor.h
        obj/UpdateRecord.cpp
        include/obj/UpdateRecord.h
        exception/UpdaterException.cpp
        include/exception/UpdaterException.h
        exception/FileWriteExcpetion.cpp
        include/exception/FileWriteExcpetion.h
        include/config/proceessing/record/IUpdateRecorder.h
        config/log/BasisLogger.cpp
        include/config/log/BasisLogger.h
        include/config/log/BasisLogger.h
        include/config/server_api/IUpdaterServer.h
        include/config/server_api/result_obj/ReqValue.h
        include/config/server_api/ServerAPIState.h
        include/utils/HttpUtils.hpp
        utils/curl_modify/CURLCompatible.cpp
        include/utils/curl_modify/CURLCompatible.h
        include/utils/curl_modify/CURLCompatible.h
        include/utils/curl_modify/ResponseType.h
        include/config/proceessing/file/IFileProcessor.h
        obj/File.cpp
        include/obj/File.h
        include/utils/VersionUtils.hpp
        exception/UnConnectServerException.cpp
        include/exception/UnConnectServerException.h
        thread/ThreadPool.cpp
        include/thread/ThreadPool.h
        include/thread/ThreadFactory.h
        thread/DefaultThreadFactory.cpp
        include/thread/DefaultThreadFactory.h
        config/proceessing/UpdateTaskRunnable.cpp
        include/config/proceessing/UpdateTaskRunnable.h
        exception/FileUnableDeleteException.cpp
        include/exception/FileUnableDeleteException.h
        config/handler/DefaultUpdaterHandler.cpp
        include/config/handler/DefaultUpdaterHandler.h
        config/proceessing/search/IntelligentSearchProcessor.cpp
        include/config/proceessing/search/IntelligentSearchProcessor.h
        config/server_api/DefaultUpdaterAPI.cpp
        include/config/server_api/DefaultUpdaterAPI.h
        include/config/server_api/APIUrl.h
        config/server_api/result_obj/data/ValueData.cpp
        include/config/server_api/result_obj/data/ValueData.h
        config/proceessing/file/DefaultFileProcessor.cpp
        include/config/proceessing/file/DefaultFileProcessor.h
        include/config/proceessing/file/DefaultFileProcessor.h
        exception/FileUnableCreateException.cpp
        include/exception/FileUnableCreateException.h
        config/proceessing/record/DefaultUpdateRecorder.cpp
        include/config/proceessing/record/DefaultUpdateRecorder.h
        exception/FileReadException.cpp
        include/exception/FileReadException.h
        exception/FileTypeException.cpp
        include/exception/FileTypeException.h
        exception/ExistingVersionUseException.cpp
        include/exception/ExistingVersionUseException.h
        exception/VersionUnUseException.cpp
        include/exception/VersionUnUseException.h
        config/transmit/BasisStreamTransmit.cpp
        include/config/transmit/BasisStreamTransmit.h
        ODUpdater.cpp
        include/utils/JsonUtils.h
        include/utils/SerializeJson.h
)

#include_directories(../../../C++/curl-8.12.1/include)
##include_directories(../../../C++/json_include)
##
#link_directories(../../../C++/curl-8.12.1/lib)

#set(BUILD_SHARED_LIBS OFF)

#set(CURL_ROOT ../../../C++/curl-8.12.1/cmake-build-debug/lib/libcurl-d.a)

find_package(CURL REQUIRED)
find_package(nlohmann_json REQUIRED)

#add_executable(test_program test/test.cpp)

target_link_libraries(ODUpdaterSDK
        PRIVATE
        CURL::libcurl
        nlohmann_json::nlohmann_json
)

target_include_directories(ODUpdaterSDK PUBLIC include)

#target_link_libraries(test_program
#        PRIVATE
#        CURL::libcurl
#        nlohmann_json::nlohmann_json
#        ODUpdaterSDK
#)

#if (MINGW)
#    target_link_libraries(test_program PRIVATE ws2_32 winmm wldap32 crypt32)
#endif()
